/*
 * 文件名:BaseEntity.java
 * 创建时间:2010-03-10
 * 版本:1.0
 * 版权所有:杨涛
 */
package com.yangtao.framework.hibernate;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 所有的实体类的父类，集成了一些公用属性
 *
 * @author 杨涛
 */
@SuppressWarnings("serial")
@MappedSuperclass
public abstract class BaseEntity implements Serializable {

	/**
	 * 主键
	 */
	@Id
	@GeneratedValue(generator = "custgenerator")
	@GenericGenerator(strategy = "pool", name = "custgenerator")
	@Column(name = "id", length = 20)
	protected String id;

	/**
	 * 数据版本号
	 */
	@Version
	@Column(name = "version")
	protected Long version;

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return the version
	 */
	public Long getVersion() {
		return version;
	}

	/**
	 * @param version the version to set
	 */
	public void setVersion(Long version) {
		this.version = version;
	}
}
